package day05;
import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {
       /*int[] a = new int[5];
       double[] b = new double[26];//声明浮点型数组b，包含26个元素，默认值都为0.0。
       boolean[] c = new boolean[23];//声明布尔型数组c，包含23个元素，默认值都是float.
       int[] arr1 = new int[3];
       int[] arr2 ={2,5,8};
       int[] arr3 = new int[]{2,5,8};
       int[] arr4;
       arr4 = new int[]{2,5,8};
       int[] num = new int[8];
       num[7]=100;
        System.out.println(num[7]);

        int[] arr = new int[10];
        arr[arr.length-1]=100;
        arr[arr.length-2]=200;
        arr[0]=300;
        System.out.println(+arr[9]+arr[8]+arr[0]);
        int[] arr= new int[10];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }*/
        int[] arr = new int[10];
        for (int i =0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }
        Arrays.sort(arr);
        System.out.println("排序后");
        for (int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("倒着输出");
        for (int i=arr.length-1;i>=0;i--){
            System.out.println(arr[i]);
        }

        }
}
